import axios from 'axios'

const service = axios.create({
  baseURL: 'https://api.nilbrains.com',
  timeout: 5000 // 请求超时时间
})

service.interceptors.request.use(
  config => {
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

service.interceptors.response.use(
  response => {
    const res = response.data
    return res
  },
  error => {
    return Promise.reject(error)
  }
)
window.axios = service
export default service
